/*     */ package com.zimbra.cs.stats;
/*     */ 
/*     */ import com.zimbra.common.stats.Accumulator;
/*     */ import com.zimbra.common.stats.Counter;
/*     */ import com.zimbra.common.stats.DeltaCalculator;
/*     */ import com.zimbra.common.stats.StopWatch;
/*     */ import com.zimbra.cs.db.DbPool;
/*     */ import com.zimbra.cs.mailbox.MessageCache;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Collections;
/*     */ import java.util.List;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class JmxServerStats
/*     */   implements JmxServerStatsMBean
/*     */ {
/*  31 */   private DeltaCalculator mDbConn = new DeltaCalculator(ZimbraPerf.STOPWATCH_DB_CONN);
/*  32 */   private DeltaCalculator mLdapConn = new DeltaCalculator(ZimbraPerf.STOPWATCH_LDAP_DC);
/*  33 */   private DeltaCalculator mItemCache = new DeltaCalculator(ZimbraPerf.COUNTER_MBOX_ITEM_CACHE);
/*  34 */   private DeltaCalculator mMailboxCache = new DeltaCalculator(ZimbraPerf.COUNTER_MBOX_CACHE);
/*  35 */   private DeltaCalculator mMessageCache = new DeltaCalculator(ZimbraPerf.COUNTER_MBOX_MSG_CACHE);
/*     */   
/*  37 */   private DeltaCalculator mAddMessage = new DeltaCalculator(ZimbraPerf.STOPWATCH_MBOX_ADD_MSG);
/*  38 */   private DeltaCalculator mImap = new DeltaCalculator(ZimbraPerf.STOPWATCH_IMAP);
/*  39 */   private DeltaCalculator mPop = new DeltaCalculator(ZimbraPerf.STOPWATCH_POP);
/*  40 */   private DeltaCalculator mSoap = new DeltaCalculator(ZimbraPerf.STOPWATCH_SOAP);
/*  41 */   private DeltaCalculator mBisSeek = new DeltaCalculator(ZimbraPerf.COUNTER_BLOB_INPUT_STREAM_SEEK_RATE);
/*     */   private final List<Accumulator> mAccumulators;
/*     */   
/*     */   JmxServerStats()
/*     */   {
/*  46 */     List<Accumulator> accumulators = new ArrayList();
/*     */     
/*  48 */     accumulators.add(this.mDbConn);
/*  49 */     accumulators.add(this.mLdapConn);
/*  50 */     accumulators.add(this.mItemCache);
/*  51 */     accumulators.add(this.mMailboxCache);
/*  52 */     accumulators.add(this.mMessageCache);
/*     */     
/*  54 */     accumulators.add(this.mAddMessage);
/*  55 */     accumulators.add(this.mImap);
/*  56 */     accumulators.add(this.mPop);
/*  57 */     accumulators.add(this.mSoap);
/*  58 */     accumulators.add(this.mBisSeek);
/*     */     
/*  60 */     this.mAccumulators = Collections.unmodifiableList(accumulators);
/*     */   }
/*     */   
/*     */   public long getDatabaseConnectionGets() {
/*  64 */     return ZimbraPerf.STOPWATCH_DB_CONN.getCount();
/*     */   }
/*     */   
/*     */   public long getDatabaseConnectionGetMs() {
/*  68 */     return this.mDbConn.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getDatabaseConnectionsInUse() {
/*  72 */     return DbPool.getSize();
/*     */   }
/*     */   
/*     */   public long getLdapDirectoryContextGetMs() {
/*  76 */     return this.mLdapConn.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getLdapDirectoryContextGets() {
/*  80 */     return ZimbraPerf.STOPWATCH_LDAP_DC.getCount();
/*     */   }
/*     */   
/*     */   public long getLmtpDeliveredBytes() {
/*  84 */     return ZimbraPerf.COUNTER_LMTP_DLVD_BYTES.getTotal();
/*     */   }
/*     */   
/*     */   public long getLmtpReceivedBytes() {
/*  88 */     return ZimbraPerf.COUNTER_LMTP_RCVD_BYTES.getTotal();
/*     */   }
/*     */   
/*     */   public long getLmtpDeliveredMessages() {
/*  92 */     return ZimbraPerf.COUNTER_LMTP_DLVD_MSGS.getTotal();
/*     */   }
/*     */   
/*     */   public long getLmtpReceivedMessages() {
/*  96 */     return ZimbraPerf.COUNTER_LMTP_RCVD_MSGS.getTotal();
/*     */   }
/*     */   
/*     */   public long getLmtpRecipients() {
/* 100 */     return ZimbraPerf.COUNTER_LMTP_RCVD_RCPT.getTotal();
/*     */   }
/*     */   
/*     */   public long getImapRequests() {
/* 104 */     return ZimbraPerf.STOPWATCH_IMAP.getCount();
/*     */   }
/*     */   
/*     */   public long getItemCacheHitRate() {
/* 108 */     return this.mItemCache.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getMailboxCacheHitRate() {
/* 112 */     return this.mMailboxCache.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getMailboxCacheSize() {
/* 116 */     return ZimbraPerf.getMailboxCacheSize();
/*     */   }
/*     */   
/*     */   public long getMailboxGets() {
/* 120 */     return ZimbraPerf.STOPWATCH_MBOX_GET.getCount();
/*     */   }
/*     */   
/*     */   public long getMailboxGetMs() {
/* 124 */     return this.mMailboxCache.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getMessageAddMs() {
/* 128 */     return this.mAddMessage.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getMessageCacheSize() {
/* 132 */     return MessageCache.getSize();
/*     */   }
/*     */   
/*     */   public long getMessageCacheHitRate() {
/* 136 */     return this.mMessageCache.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getMessagesAdded() {
/* 140 */     return ZimbraPerf.STOPWATCH_MBOX_ADD_MSG.getCount();
/*     */   }
/*     */   
/*     */   public long getSoapRequests() {
/* 144 */     return ZimbraPerf.STOPWATCH_SOAP.getCount();
/*     */   }
/*     */   
/*     */   public long getSoapResponseMs() {
/* 148 */     return this.mSoap.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getBlobInputStreamReads() {
/* 152 */     return ZimbraPerf.COUNTER_BLOB_INPUT_STREAM_READ.getCount();
/*     */   }
/*     */   
/*     */   public long getBlobInputStreamSeekRate() {
/* 156 */     return this.mBisSeek.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getImapResponseMs() {
/* 160 */     return this.mImap.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public long getPopRequests() {
/* 164 */     return ZimbraPerf.STOPWATCH_POP.getCount();
/*     */   }
/*     */   
/*     */   public long getPopResponseMs() {
/* 168 */     return this.mPop.getRealtimeAverage();
/*     */   }
/*     */   
/*     */   public void reset() {
/* 172 */     for (Accumulator accum : this.mAccumulators) {
/* 173 */       accum.reset();
/*     */     }
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/stats/JmxServerStats.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */